<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:a="https://github.com/pylonide/pylon" xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>MASTER CLIENT</title>
        <script src="../ppc.js"></script>
        <style type="text/css">
            #message_log {
                border: 1px solid silver;
                font-family: "Lucida Console", Sans Serif;
                padding: 8px;
                color: green;
                background: #333;
                height: 250px;
                width: 250px;
            }

            .loginform {
                width: 250px;
                border: 1px solid silver;
            }
        </style>
    </head>
    <body>
        <a:skin src="../skins.xml" media-path="../../../skins/platform/trunk/images/"
          image-path="../../../skins/platform/trunk/images/" icon-path="../icons/" />

        <a:appsettings debug="false" debug-teleport="true" name="remotetest" locking="optimistic"  />

        <a:persist id="myPersist" host="http://dev2.worknets.com:8124" />
        <a:remote transport="myPersist" id="rmtFs" />

        <a:model id="mdlFs" remote="rmtFs" />
            
        <a:textbox value="[mdlFs::status]" realtime="true" />
        <a:textbox value="[mdlFs::status]" realtime="true" />

        <a:model id="mdlDashboard" remote="rmtFs" />

        <!--a:button onclick="myPersist.connect('jane@campell.com', 'geheim')" width="80">Login</a:button>
        <a:button onclick="myPersist.disconnect()" width="80">Logout</a:button-->
        
        <a:script>
            rmtFs.addEventListener("modelfind", function(e){
                if (e.resource.indexOf("dashboard") > -1)
                    return mdlDashboard;
                else if (e.resource.indexOf("101") > -1) 
                    return mdlFs;
            });
            
            if (ppc.isIE)
                myPersist.connect('jane@campell.com', 'geheim');//, 'rdb://worknets.com/101');
            else
                myPersist.connect('jharrison@bi.nl', '101', 'rdb://worknets.com/101');
            
            setTimeout(function(){
                //Test change
                //mdlFs.setQueryValue("status", "Working hard " + new Date().getTime());
                
                //Test create
                myPersist.create("rdb://worknets.com/worknet", function(data){
                    ppc.console.log("RECEIVED: " + data);
                    myPersist.join(data);
                });
                
                //Test logout
                //myPersist.disconnect();
            }, 1000);
        </a:script>
    </body>
</html>